package framework.druid;

import com.alibaba.druid.filter.config.ConfigTools;

/**
 * druid 加密、解密：
 *  config.decrypt=true;
 *  config.decrypt.key=
 */
public class DruidToolTest {

    public static void main(String[] args) throws Exception {
        // 解密
        String publicKeyText = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnR8GeU8mA8EKAUChPfiySVg0PKVUOltDwDgc9kFUa5peQGHD7tcSxsbf8lRcvrGNY0WFa+i5Ey3u9WlsCLKOBAIfLOeXwD6THfwV8dBXm1fPNRUPBGBjgHprWAZSY/O+zQPRKJcsc/OofPYRxf8JdPcRJWvjXnobFAT8M9ccIIajE54Y65IGRbQDBw4ZwKtHBCst8cObpduPuR1XK2YcZzeG0QAsBWznwADLPc0OEwDSW8NQfTCSejcSY6ef8K89A9+yRg7zK0xve/0a0rZty0GTs2fI5c7eCss/l+3+tHgWGxjMfJ7y5f7ElF490CkDbPrHvRHLtPgjlng8TrwzLQIDAQAB";
        String cipherText = "GRw0gQkWcDCcQowETTNkLpdGzrNaXQF9+PaACBkJXkrq7+glsa0z4NadLsqIFv1VK9fnMuBNSWUK0AVYow4fjbB+LoMGBBxXog/xQXnOu7jVCHNDOVf693wIap6Y94R5b3P+TV3SNmPvp9UIRMvhBX33KYAzfF+ZzGCJxhzWX6A7ir5T7Y5YNVw/dQ7e0KXW8G8k/SwmZx+D4PlQKdqNpixlclfqD4PLB1/gxoN8Ch3ALY/mAwJ9NXHe/KWZLsg9D59RNQvkUUPq6PktieksZGnK/+HMdsniR8ee8bfz1mKESHzX3v2hnKFsj4KB+pQnt8Xq0YP9EsXUff2+0IraLw==";
        String decryptword = ConfigTools.decrypt(publicKeyText, cipherText);
        System.out.println(decryptword);

        //加密
        String password ="1234";
        String encryptword = ConfigTools.encrypt(password);
        System.out.println(encryptword);
    }

}
